﻿using System;
using System.Collections;
using Common;
using Dto;

namespace Business
{
    public class FillDto
    {
        public static ManageMenuDto FillManageMenudto(Hashtable ht)
        {
            var dto = new ManageMenuDto
                          {
                              MenuID = ht.ContainsKey("MenuID") ? Convert.ToInt32(ht["MenuID"]) : 0,
                              MenuKey = ht.ContainsKey("MenuKey") ? ht["MenuKey"].ToString() : "",
                              MenuName = ht.ContainsKey("MenuName") ? ht["MenuName"].ToString() : "",
                              MenuOrder = ht.ContainsKey("MenuOrder") ? Convert.ToInt32(ht["MenuOrder"]) : 0,
                              MenuPath = ht.ContainsKey("MenuPath") ? ht["MenuPath"].ToString() : "",
                              MenuSuperiorID =
                                  ht.ContainsKey("MenuSuperiorID") ? Convert.ToInt32(ht["MenuSuperiorID"]) : 0
                          };
            return dto;
        }

        public static AdminDto FillAdmindto(Hashtable ht)
        {
            var dto = new AdminDto
                          {
                              AdminAddress = ht.ContainsKey("AdminAddress") ? ht["AdminAddress"].ToString() : "",
                              AdminDate = ht.ContainsKey("AdminDate") ? Convert.ToDateTime(ht["AdminDate"]) : DateTime.Now,
                              AdminEmail = ht.ContainsKey("AdminEmail") ? ht["AdminEmail"].ToString() : "",
                              AdminName = ht.ContainsKey("AdminName") ? ht["AdminName"].ToString() : "",
                              AdminPwd = ht.ContainsKey("AdminPwd") ? ht["AdminPwd"].ToString() : "",
                              AdminRoleID = ht.ContainsKey("AdminRoleID") ? Convert.ToInt32(ht["AdminRoleID"]) : 0,
                              AdminSex = ht.ContainsKey("AdminSex") ? Convert.ToInt32(ht["AdminSex"]) : 0,
                              AdminTel = ht.ContainsKey("AdminTel") ? ht["AdminTel"].ToString() : "",
                              AdminTrueName = ht.ContainsKey("AdminTrueName") ? ht["AdminTrueName"].ToString() : "",
                              AdminId = ht.ContainsKey("AdminID") ? Convert.ToInt32(ht["AdminID"]) : 0,
                              AdminPhotoID = ht.ContainsKey("AdminPhotoID") ? Convert.ToInt32(ht["AdminPhotoID"]) : 0,
                          };
            return dto;
        }

        public static AdminRoleDto FillAdminRoledto(Hashtable ht)
        {
            var dto = new AdminRoleDto
                          {
                              RoleContent = ht.ContainsKey("RoleContent") ? ht["RoleContent"].ToString() : "",
                              RoleID = ht.ContainsKey("RoleID") ? Convert.ToInt32(ht["RoleID"]) : 0,
                              RoleName = ht.ContainsKey("RoleName") ? ht["RoleName"].ToString() : "",
                              RoleTime = ht.ContainsKey("RoleTime") ? Convert.ToDateTime(ht["RoleTime"]) : DateTime.Now,
                          };
            return dto;
        }

        public static SiteChannelDto FillSiteChannelDto(Hashtable ht)
        {
            var dto = new SiteChannelDto
                          {
                              ChannelCode = ht.ContainsKey("ChannelCode") ? ht["ChannelCode"].ToString() : "",
                              ChannelId = ht.ContainsKey("ChannelId") ? Convert.ToInt32(ht["ChannelId"]) : 0,
                              ChannelIndexImg = ht.ContainsKey("ChannelIndexImg") ? ht["ChannelIndexImg"].ToString() : "",
                              ChannelName = ht.ContainsKey("ChannelName") ? ht["ChannelName"].ToString() : "",
                              ChannelTemplateId = ht.ContainsKey("ChannelTemplateId") ? Convert.ToInt32(ht["ChannelTemplateId"]) : 0,
                              ChannelTime = ht.ContainsKey("ChannelTime") ? Convert.ToDateTime(ht["ChannelTime"]) : DateTime.Now,
                              ChannelCurState = ht.ContainsKey("ChannelCurState") ? Convert.ToInt32(ht["ChannelCurState"]) : 0,
                          };
            return dto;
        }

        public static UsersDto FillUsersDto(Hashtable ht)
        {
            var dto = new UsersDto
                          {
                              UserEmail = ht.ContainsKey("UserEmail") ? ht["UserEmail"].ToString() : "",
                              UserId = ht.ContainsKey("UserId") ? Convert.ToInt32(ht["UserId"]) : 0,
                              UserName = ht.ContainsKey("UserName") ? ht["UserName"].ToString() : "",
                              UserPwd = ht.ContainsKey("UserPwd") ? ht["UserPwd"].ToString() : "",
                              UserTime = ht.ContainsKey("UserTime") ? Convert.ToDateTime(ht["UserTime"]) : DateTime.Now,
                              UserType = ht.ContainsKey("UserType") ? Convert.ToInt32(ht["UserType"]) : 0,
                          };
            return dto;
        }

        public static SportsGroupDto FillSportsGroupDto(Hashtable ht)
        {
            var dto = new SportsGroupDto
                          {
                              GroupChannel = ht.ContainsKey("GroupChannel") ? ht["GroupChannel"].ToString() : "",
                              GroupCode = ht.ContainsKey("GroupCode") ? ht["GroupCode"].ToString() : "",
                              GroupCreator = ht.ContainsKey("GroupCreator") ? Convert.ToInt32(ht["GroupCreator"]) : 0,
                              GroupId = ht.ContainsKey("GroupId") ? Convert.ToInt32(ht["GroupId"]) : 0,
                              GroupLogo = ht.ContainsKey("GroupLogo") ? Convert.ToInt32(ht["GroupLogo"]) : 0,
                              GroupName = ht.ContainsKey("GroupName") ? ht["GroupName"].ToString() : "",
                              GroupSummary = ht.ContainsKey("GroupSummary") ? ht["GroupSummary"].ToString() : "",
                              GroupTemplateId = ht.ContainsKey("GroupTemplateId") ? Convert.ToInt32(ht["GroupTemplateId"]) : 0,
                              GroupTime = ht.ContainsKey("GroupTime") ? Convert.ToDateTime(ht["GroupTime"]) : DateTime.Now,
                          };
            return dto;
        }

        public static GroupTopicDto FillGroupTopicDto(Hashtable ht)
        {
            var dto = new GroupTopicDto
                          {
                              GtGroupId = ht.ContainsKey("GtGroupId") ? Convert.ToInt32(ht["GtGroupId"]) : 0,
                              GtId = ht.ContainsKey("GtId") ? Convert.ToInt32(ht["GtId"]) : 0,
                              GtSponsor = ht.ContainsKey("GtSponsor") ? Convert.ToInt32(ht["GtSponsor"]) : 0,
                              GtTime = ht.ContainsKey("GtTime") ? Convert.ToDateTime(ht["GtTime"]) : DateTime.Now,
                              GtTitle = ht.ContainsKey("GtTitle") ? ht["GtTitle"].ToString() : ""
                          };
            return dto;
        }

        public static TopicDetailsDto FillTopicDetailsDto(Hashtable ht)
        {
            var dto = new TopicDetailsDto
                          {
                              TdContent = ht.ContainsKey("TdContent") ? ht["TdContent"].ToString() : "",
                              TdId = ht.ContainsKey("TdId") ? Convert.ToInt32(ht["TdId"]) : 0,
                              TdParentId = ht.ContainsKey("TdParentId") ? Convert.ToInt32(ht["TdParentId"]) : 0,
                              TdTime = ht.ContainsKey("TdTime") ? Convert.ToDateTime(ht["TdTime"]) : DateTime.Now,
                              TdTopicId = ht.ContainsKey("TdTopicId") ? Convert.ToInt32(ht["TdTopicId"]) : 0,
                              TdUserId = ht.ContainsKey("TdUserId") ? Convert.ToInt32(ht["TdUserId"]) : 0,
                          };
            return dto;
        }

        public static AnnexDto FillAnnexDto(Hashtable ht)
        {
            var dto = new AnnexDto
                          {
                              AnnexDate =
                                  ht.ContainsKey("AnnexDate") ? Convert.ToDateTime(ht["AnnexDate"]) : DateTime.Now,
                              AnnexDomain = ht.ContainsKey("AnnexDomain") ? ht["AnnexDomain"].ToString() : "",
                              AnnexHeight = ht.ContainsKey("AnnexHeight") ? Convert.ToInt32(ht["AnnexHeight"]) : 0,
                              AnnexID = ht.ContainsKey("AnnexID") ? Convert.ToInt32(ht["AnnexID"]) : 0,
                              AnnexName = ht.ContainsKey("AnnexName") ? ht["AnnexName"].ToString() : "",
                              AnnexNarrowPath =
                                  ht.ContainsKey("AnnexNarrowPath") ? ht["AnnexNarrowPath"].ToString() : "",
                              AnnexOriginalPath =
                                  ht.ContainsKey("AnnexOriginalPath") ? ht["AnnexOriginalPath"].ToString() : "",
                              AnnexSize = ht.ContainsKey("AnnexSize") ? Convert.ToInt32(ht["AnnexSize"]) : 0,
                              AnnexWidth = ht.ContainsKey("AnnexWidth") ? Convert.ToInt32(ht["AnnexWidth"]) : 0,
                          };
            return dto;
        }

        public static UserAlbumDto FillUserAlbumDto(Hashtable ht)
        {
            var dto = new UserAlbumDto
                          {
                              AlbumId = ht.ContainsKey("AlbumId") ? Convert.ToInt32(ht["AlbumId"]) : 0,
                              AlbumName = ht.ContainsKey("AlbumName") ? ht["AlbumName"].ToString() : "",
                              AlbumTime = ht.ContainsKey("AlbumTime") ? Convert.ToDateTime(ht["AlbumTime"]) : DateTime.Now,
                              AlbumUserId = ht.ContainsKey("AlbumUserId") ? Convert.ToInt32(ht["AlbumUserId"]) : 0
                          };
            return dto;
        }

        public static UserPhotoDto FillUserPhotoDto(Hashtable ht)
        {
            var dto = new UserPhotoDto
                          {
                              PhotoAlbumId = ht.ContainsKey("PhotoAlbumId") ? Convert.ToInt32(ht["PhotoAlbumId"]) : 0,
                              PhotoAnnexId = ht.ContainsKey("PhotoAlbumId") ? Convert.ToInt32(ht["PhotoAnnexId"]) : 0,
                              PhotoDesc = ht.ContainsKey("PhotoAlbumId") ? ht["PhotoAlbumId"].ToString() : "",
                              PhotoId = ht.ContainsKey("PhotoId") ? Convert.ToInt32(ht["PhotoId"]) : 0,
                              PhotoName = ht.ContainsKey("PhotoName") ? ht["PhotoName"].ToString() : "",
                              PhotoTime = ht.ContainsKey("PhotoTime") ? Convert.ToDateTime(ht["PhotoTime"]) : DateTime.Now,
                              PhotoUserId = ht.ContainsKey("PhotoUserId") ? Convert.ToInt32(ht["PhotoUserId"]) : 0
                          };
            return dto;
        }

        public static UserMovingDto FillUserMovingDto(Hashtable ht)
        {
            var dto = new UserMovingDto
                          {
                              MovingContent = ht.Contains("MovingContent") ? ht["MovingContent"].ToString() : "",
                              MovingId = ht.Contains("MovingId") ? Convert.ToInt32(ht["MovingId"]) : 0,
                              MovingTime =
                                  ht.Contains("MovingTime") ? Convert.ToDateTime(ht["MovingTime"]) : DateTime.Now,
                              MovingUserId = ht.Contains("MovingUserId") ? Convert.ToInt32(ht["MovingUserId"]) : 0,
                              MovingType = ht.Contains("MovingType") ? Convert.ToInt32(ht["MovingType"]) : 0
                          };
            return dto;
        }

        public static GroupActivityDto FillGroupActivityDto(Hashtable ht)
        {
            var dto = new GroupActivityDto
                          {
                              GaAddress = ht.ContainsKey("GaAddress") ? ht["GaAddress"].ToString() : "",
                              GaAudit = ht.ContainsKey("GaAudit") ? Convert.ToInt32(ht["GaAudit"]) : 0,
                              GaCity = ht.ContainsKey("GaCity") ? ht["GaCity"].ToString() : "",
                              GaCurState = ht.ContainsKey("GaCurState") ? Convert.ToInt32(ht["GaCurState"]) : 0,
                              GaEndDate = ht.ContainsKey("GaEndDate") ? Convert.ToDateTime(ht["GaEndDate"]) : DateTime.MinValue,
                              GaEndTime = ht.ContainsKey("GaEndTime") ? ht["GaEndTime"].ToString() : "",
                              GaFee = ht.ContainsKey("GaFee") ? Convert.ToDecimal(ht["GaFee"]) : Convert.ToDecimal(0.00),
                              GaFrontCover = ht.ContainsKey("GaFrontCover") ? Convert.ToInt32(ht["GaFrontCover"]) : 0,
                              GaGroupId = ht.ContainsKey("GaGroupId") ? Convert.ToInt32(ht["GaGroupId"]) : 0,
                              GaId = ht.ContainsKey("GaId") ? Convert.ToInt32(ht["GaId"]) : 0,
                              GaInputTime = ht.ContainsKey("GaInputTime") ? Convert.ToDateTime(ht["GaInputTime"]) : DateTime.MinValue,
                              GaMode = ht.ContainsKey("GaMode") ? Convert.ToInt32(ht["GaMode"]) : 0,
                              GaPayType = ht.ContainsKey("GaPayType") ? Convert.ToInt32(ht["GaPayType"]) : 0,
                              GaRemark = ht.ContainsKey("GaRemark") ? ht["GaRemark"].ToString() : "",
                              GaSponsor = ht.ContainsKey("GaSponsor") ? Convert.ToInt32(ht["GaSponsor"]) : 0,
                              GaSportId = ht.ContainsKey("GaSportId") ? Convert.ToInt32(ht["GaSportId"]) : 0,
                              GaStartDate = ht.ContainsKey("GaStartDate") ? Convert.ToDateTime(ht["GaStartDate"]) : DateTime.MinValue,
                              GaStartTime = ht.ContainsKey("GaStartTime") ? ht["GaStartTime"].ToString() : "",
                              GaTitle = ht.ContainsKey("GaTitle") ? ht["GaTitle"].ToString() : "",
                              GaType = ht.ContainsKey("GaType") ? Convert.ToInt32(ht["GaType"]) : 0,
                          };
            return dto;
        }

        public static UserAttentionDto FillUserAttentionDto(Hashtable ht)
        {
            var dto = new UserAttentionDto
                          {
                              UaConcernUserId =
                                  ht.ContainsKey("UaConcernUserId") ? Convert.ToInt32(ht["UaConcernUserId"]) : 0,
                              UaId = ht.ContainsKey("UaId") ? Convert.ToInt32(ht["UaId"]) : 0,
                              UaTime = ht.ContainsKey("UaTime") ? Convert.ToDateTime(ht["UaTime"]) : DateTime.MinValue,
                              UaUserId = ht.ContainsKey("UaUserId") ? Convert.ToInt32(ht["UaUserId"]) : 0
                          };
            return dto;
        }
    }
}